Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Displayer for QueryRowsResult #1138

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Michu1596
Copy link

@Michu1596 Michu1596 commented Dec 4, 2024

This PR adds Displayer for QueryRowsResult trying to mimic cqlsh way of displaying tables with one exception I implement the display for the duration type differently, because I think cqlsh displays this type in an unclear way,for more details look in the comments.

Fixes: #999

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • I added relevant tests for new features and bug fixes.
  • All commits compile, pass static checks and pass test.
  • PR description sums up the changes and reasons why they should be introduced.
  • I have provided docstrings for the public items that I want to introduce.
  • I have adjusted the documentation in ./docs/source/.
  • I added appropriate Fixes: annotations to PR description.

@wprzytula wprzytula changed the title Displayer for QueryRowsResult #999 Displayer for QueryRowsResult Dec 4, 2024
@Michu1596 Michu1596 force-pushed the query_rows_result_displayer branch from c8ad86d to ddf3d5d Compare December 6, 2024 16:20
Comment on lines 458 to 466
/// # use scylla::transport::query_result::{QueryResult, QueryRowsResult, RowsDisplayer};
/// # fn example(query_result: QueryResult) -> Result<(), Box<dyn std::error::Error>> {
/// let rows_result = query_result.into_rows_result()?;
/// let mut displayer = RowsDisplayer::new(&rows_result);
/// displayer.set_terminal_width(80);
/// displayer.use_color(true);
/// println!("{}", displayer);
/// # Ok(())
/// # }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Missing indentation in function's body.

@Michu1596
Copy link
Author

obraz
screenshot shows results of command SCYLLA_URI="127.0.0.1:9042" cargo run --example displayer

note the difference between the way cqlsh is displaying duration
obraz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Display for QueryResult
2 participants